package org.jeecg.modules.golf.user.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.modules.golf.question.client.qto.QuestionQueryPageDTO;
import org.jeecg.modules.golf.user.client.TraineeAgeDistDTO;
import org.jeecg.modules.golf.user.client.TraineeChadianDistDTO;
import org.jeecg.modules.golf.user.client.TraineeRealNameDistDTO;
import org.jeecg.modules.golf.user.client.TraineeSexDistDTO;
import org.jeecg.modules.golf.user.service.ITraineeService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author jiguansheng
 * @date 2020/12/18
 **/

@Api(tags="学员")
@RestController
@RequestMapping("/user/trainee")
@Slf4j
public class TraineeAnalysisController {

    @Resource
    private ITraineeService  traineeService;

    /**
     * 分析
     * @param questionQueryPageDTO
     * @return
     */
    @GetMapping("analysis")
    public Map<String,Object> analysis(QuestionQueryPageDTO questionQueryPageDTO){
        Map<String,Object> resultMap = new HashMap<>(4);
        Page<TraineeRealNameDistDTO> traineeRealNameDistDTOPage = traineeService.distName(questionQueryPageDTO);
        List<TraineeAgeDistDTO> traineeAgeDistDTOList = traineeService.distAge(questionQueryPageDTO);
        List<TraineeChadianDistDTO> traineeChadianDistDTO = traineeService.distChadian(questionQueryPageDTO);
        TraineeSexDistDTO traineeSexDistDTO = traineeService.distSex(questionQueryPageDTO);
        resultMap.put("distName",traineeRealNameDistDTOPage);
        resultMap.put("distAge",traineeAgeDistDTOList);
        resultMap.put("distChadian",traineeChadianDistDTO);
        resultMap.put("distSex",traineeSexDistDTO);
        return resultMap;
    }




}
